/*
    Heart of Gold engine management system
    Copyright (C) 2004 Heart of Gold development team

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/*
 * The Menu Page for the Megasquirt HOG_Component
 * @author Ryan Higgins
 * @date May 2004
 */

package com.heartOfGold.view;


import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
//import javax.swing.SpringLayout;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
//import javax.swing.JOptionPane;
import javax.swing.JPanel;

//import javax.swing.JProgressBar;

/*
 */

public class FuelMain extends JPanel implements ActionListener {
    //TODO set variables private make accessors if needed
    FuelMaster master;
    String[] labels = {"Setup Wizard", "Engine and Injector Setup",
            "Enrichment Setup", "Fuel Mixture Table", "In Flight Tuning",
            "Digital Dashboard", "Help"};
    // widgets

    JButton[] buttons;
    JPanel buttonPanel = new JPanel(new GridLayout(labels.length, 1));
    JPanel buttonBorder = new JPanel(new FlowLayout());
    BorderLayout thing = new BorderLayout();
    JPanel buttonSpring = new JPanel(new GridLayout(1, 3));
    JLabel megaLogo;

    public FuelMain(final FuelMaster m) {
        master = m;
        // Logo setup
        setLayout(thing);
        megaLogo = new JLabel(new ImageIcon("MEGAWHEELS.gif"));

        // border
        setBorder(BorderFactory.createTitledBorder("Megasquirt Fuel Injection"
                + " Controller by Bowling and Grippo"));

        // add Logo
        add(megaLogo, BorderLayout.NORTH);

        buttonPanel.setBorder(BorderFactory
                .createTitledBorder("Tuning Options"));
        // setup button panel
        buttons = new JButton[labels.length];
        for (int i = 0; i < labels.length; i++) {
            buttons[i] = new JButton(labels[i]);
            buttonPanel.add(buttons[i]);
            (buttons[i]).addActionListener(this);
        }

        buttonBorder.add(buttonPanel, BorderLayout.CENTER);
        add(buttonBorder, BorderLayout.CENTER);
    }

    public final void actionPerformed(final ActionEvent ae) {
        master.actionPerformed(ae);
    }

}
